clear all
set maxvar 5000

*cd "1_Data/"

**********************************
*******PRE DELIMITATION AC********
**********************************
cd "/Users/tg2778/Dropbox/0_Reviews_RnRs/072022_JOP_Roads/v3_JOP/Replication - Roads"
log using "4_Log/8_OLSResults.log"

use "1_Data/AC_pre-delim_dataset.dta", clear

egen acstateid = concat(VD01_AC_id stateid),p("_")

label var totalvillconn "Δ Connectivity"

quietly: areg change_incumbentvoteshare totalvillconn, absorb(statedistrict2) cluster(acstateid)
quietly: estimates store model1, title(base+district+clus)
quietly: estadd ysumm, me
quietly: estadd local fe "District"
quietly: estadd local cl "Constituency"

quietly: areg change_incumbentvoteshare totalvillconn, absorb(statedistrict2) cluster(statedistrict2)
quietly: estimates store model1a, title(base+district+clus)
quietly: estadd local fe "District"
quietly: estadd local cl "District"

quietly: areg change_incumbentvoteshare totalvillconn if alreadyconnected < 50, absorb(statedistrict2) cluster(acstateid)
quietly: estimates store model1b, title(base+district+clus)
quietly: estadd local fe "District"
quietly: estadd local cl "Constituency"

quietly: areg change_incumbentvoteshare totalvillconn if margin <= 15, absorb(statedistrict2) cluster(acstateid)
quietly: estimates store model1c, title(base+district+clus)
quietly: estadd local fe "District"
quietly: estadd local cl "Constituency"

quietly: areg change_incumbentvoteshare totalvillconn if rulingparty == 1, absorb(statedistrict2) cluster(acstateid)
quietly: estimates store model1d, title(base+district+clus)
quietly: estadd local fe "District"
quietly: estadd local cl "Constituency"

quietly: areg changeturnout totalvillconn, absorb(statedistrict2) cluster(acstateid)
quietly: estimates store model1e, title(base+district+clus)
quietly: estadd ysumm, me
quietly: estadd local fe "District"
quietly: estadd local cl "Constituency"

quietly: areg changebjp totalvillconn, absorb(statedistrict2) cluster(acstateid)
quietly: estimates store model1f, title(base+district+clus)
quietly: estadd ysumm, me
quietly: estadd local fe "District"
quietly: estadd local cl "Constituency"


**********************************
******POST DELIMITATION AC********
**********************************

use "1_Data/AC_post-delim_dataset.dta", clear

egen acstateid = concat(VD01_AC_id stateid),p("_")

label var totalvillconn "Δ Connectivity"


quietly: areg change_incumbentvoteshare totalvillconn, absorb(statedistrict2) cluster(acstateid)
quietly: estimates store model2, title(base+district)
quietly: estadd ysumm, me
quietly: estadd local fe "District"
quietly: estadd local cl "Constituency"

quietly: areg change_incumbentvoteshare totalvillconn, absorb(statedistrict2) cluster(statedistrict2)
quietly: estimates store model2a, title(base+district+clus)
quietly: estadd local fe "District"
quietly: estadd local cl "District"

quietly: areg change_incumbentvoteshare totalvillconn if alreadyconnected < 50, absorb(statedistrict2) cluster(acstateid)
quietly: estimates store model2b, title(base+district+clus)
quietly: estadd local fe "District"
quietly: estadd local cl "Constituency"

quietly: areg change_incumbentvoteshare totalvillconn if margin <= 15, absorb(statedistrict2) cluster(acstateid)
quietly: estimates store model2c, title(base+district+clus)
quietly: estadd local fe "District"
quietly: estadd local cl "Constituency"

quietly: areg change_incumbentvoteshare totalvillconn if rulingparty == 1, absorb(statedistrict2) cluster(acstateid)
quietly: estimates store model2d, title(base+district+clus)
quietly: estadd local fe "District"
quietly: estadd local cl "Constituency"

quietly: areg changeturnout totalvillconn, absorb(statedistrict2) cluster(acstateid)
quietly: estimates store model2e, title(base+district+clus)
quietly: estadd ysumm, me
quietly: estadd local fe "District"
quietly: estadd local cl "Constituency"

quietly: areg changebjp totalvillconn, absorb(statedistrict2) cluster(acstateid)
quietly: estimates store model2f, title(base+district+clus)
quietly: estadd ysumm, me
quietly: estadd local fe "District"
quietly: estadd local cl "Constituency"


**********************************
*******PRE DELIMITATION PC********
**********************************

use "1_Data/PC_pre-delim_dataset_select.dta", clear

egen pcstate = concat(PC_no_2001 stateid),p("_")

label var totalvillconn "Δ Connectivity"

quietly: areg change_incumbentvoteshare totalvillconn, absorb(state2) cluster(pcstate)
quietly: estimates store model3, title(base+state+clus)
quietly: estadd ysumm, me
quietly: estadd local fe "State"
quietly: estadd local cl "Constituency"

quietly: areg change_incumbentvoteshare totalvillconn, absorb(state2) cluster(state2)
quietly: estimates store model3a, title(base+state+clus)
quietly: estadd local fe "State"
quietly: estadd local cl "State"

quietly: areg change_incumbentvoteshare totalvillconn if alreadyconnected < 50, absorb(state2) cluster(pcstate)
quietly: estimates store model3b, title(base+state+clus)
quietly: estadd local fe "State"
quietly: estadd local cl "Constituency"

quietly: areg change_incumbentvoteshare totalvillconn if margin <= 15, absorb(state2) cluster(pcstate)
quietly: estimates store model3c, title(base+state+clus)
quietly: estadd local fe "State"
quietly: estadd local cl "Constituency"

quietly: areg change_incumbentvoteshare totalvillconn if rulingparty == 1, absorb(state2) cluster(pcstate)
quietly: estimates store model3d, title(base+state+clus)
quietly: estadd local fe "State"
quietly: estadd local cl "Constituency"

quietly: areg changeturnout totalvillconn, absorb(state2) cluster(pcstate)
quietly: estimates store model3e, title(base+state+clus)
quietly: estadd ysumm, me
quietly: estadd local fe "State"
quietly: estadd local cl "Constituency"

quietly: areg changebjp totalvillconn, absorb(state2) cluster(pcstate)
quietly: estimates store model3f, title(base+state+clus)
quietly: estadd ysumm, me
quietly: estadd local fe "State"
quietly: estadd local cl "Constituency"

**********************************
******POST DELIMITATION PC********
**********************************

use "1_Data/PC_post-delim_dataset_select.dta", clear

egen pcstate = concat(PC_no_2001 stateid),p("_")

label var totalvillconn "Δ Connectivity"

quietly: areg change_incumbentvoteshare totalvillconn, absorb(state2) cluster(pcstate)
quietly: estimates store model4, title(base+state+clus)
quietly: estadd ysumm, me
quietly: estadd local fe "State"
quietly: estadd local cl "Constituency"

quietly: areg change_incumbentvoteshare totalvillconn, absorb(state2) cluster(state2)
quietly: estimates store model4a, title(base+state+clus)
quietly: estadd local fe "State"
quietly: estadd local cl "State"

quietly: areg change_incumbentvoteshare totalvillconn if alreadyconnected < 50, absorb(state2) cluster(pcstate)
quietly: estimates store model4b, title(base+state+clus)
quietly: estadd local fe "State"
quietly: estadd local cl "Constituency"

quietly: areg change_incumbentvoteshare totalvillconn if margin <= 15, absorb(state2) cluster(pcstate)
quietly: estimates store model4c, title(base+state+clus)
quietly: estadd local fe "State"
quietly: estadd local cl "Constituency"

quietly: areg change_incumbentvoteshare totalvillconn if rulingparty == 1, absorb(state2) cluster(pcstate)
quietly: estimates store model4d, title(base+state+clus)
quietly: estadd local fe "State"
quietly: estadd local cl "Constituency"

quietly: areg changeturnout totalvillconn, absorb(state2) cluster(pcstate)
quietly: estimates store model4e, title(base+state+clus)
quietly: estadd ysumm, me
quietly: estadd local fe "State"
quietly: estadd local cl "Constituency"

quietly: areg changebjp totalvillconn, absorb(state2) cluster(pcstate)
quietly: estimates store model4f, title(base+state+clus)
quietly: estadd ysumm, me
quietly: estadd local fe "State"
quietly: estadd local cl "Constituency"

****************************************************************************************************

*Table 1: OLS Results

esttab model1 model2 model3 model4 using "2_Tables/Manuscript_Table1_OLS.doc", replace label b(3) se(3) title(OLS Results: Roads provision uncorrelated with change in ruling party(s) voteshare) mgroups("State elections" "National elections", pattern(1 0 1 0)) mtitles("Pre-delimitation" "Post-delimitation" "Pre-delimitation" "Post-delimitation") scalars("ymean Mean Δ incumbent voteshare" "fe Fixed effects" "cl Cluster SE") drop(_cons) addnote("Note: The dependent variable is the change in ruling party voteshare in state elections in (1) and (2), and in national elections in (3) and (4)") rtf substitute("\fs20" "\fs16" "\fs24" "\fs20") modelwidth(10)


*C.1 Alternative Clustering

*esttab model1a model2a model3a model4a using TabC1.tex, replace label b(3) se(3) title(Alternative Clustering at higher level) mgroups("State elections" "National elections", pattern(1 0 1 0) span prefix(\multicolumn{@span}{c}{) suffix(})) mtitles("Pre-delimitation" "Post-delimitation" "Pre-delimitation" "Post-delimitation") scalars("fe Fixed effects" "cl Cluster SE") drop(_cons)

esttab model1a model2a model3a model4a using "2_Tables/C1.doc", replace label b(3) se(3) title(Alternative Clustering at higher level) mgroups("State elections" "National elections", pattern(1 0 1 0)) mtitles("Pre-delimitation" "Post-delimitation" "Pre-delimitation" "Post-delimitation") scalars("fe Fixed effects" "cl Cluster SE") drop(_cons) rtf varwidth(11) substitute("\fs20" "\fs16" "\fs24" "\fs20")

*C.2 High need for roads

esttab model1b model2b model3b model4b using "2_Tables/C2.doc", replace label b(3) se(3) title(Constituencies where majority villages lack paved road at baseline) mgroups("State elections" "National elections", pattern(1 0 1 0)) mtitles("Pre-delimitation" "Post-delimitation" "Pre-delimitation" "Post-delimitation") scalars("fe Fixed effects" "cl Cluster SE") drop(_cons) rtf varwidth(11) substitute("\fs20" "\fs16" "\fs24" "\fs20")

*C.3 Competitive Challengers

esttab model1c model2c model3c model4c using "2_Tables/C3.doc", replace label b(3) se(3) title(Constituencies where margin of victory between two candidates is under 15%) mgroups("State elections" "National elections", pattern(1 0 1 0)) mtitles("Pre-delimitation" "Post-delimitation" "Pre-delimitation" "Post-delimitation") scalars("fe Fixed effects" "cl Cluster SE") drop(_cons) rtf varwidth(11) substitute("\fs20" "\fs16" "\fs24" "\fs20")

*C.4 Ruling party constituencies

esttab model1d model2d model3d model4d using "2_Tables/C4.doc", replace label b(3) se(3) title(Ruling party constituencies) mgroups("State elections" "National elections", pattern(1 0 1 0)) mtitles("Pre-delimitation" "Post-delimitation" "Pre-delimitation" "Post-delimitation") scalars("fe Fixed effects" "cl Cluster SE") drop(_cons) rtf varwidth(11) substitute("\fs20" "\fs16" "\fs24" "\fs20")

*C.5 Change in turnout

esttab model1e model2e model3e model4e using "2_Tables/C5.doc", replace label b(3) se(3) title(Change in turnout) mgroups("State elections" "National elections", pattern(1 0 1 0)) mtitles("Pre-delimitation" "Post-delimitation" "Pre-delimitation" "Post-delimitation") scalars("ymean Mean Δ turnout" "fe Fixed effects" "cl Cluster SE") drop(_cons) rtf varwidth(11) substitute("\fs20" "\fs16" "\fs24" "\fs20")

*C.6 Change in BJP voteshare

esttab model1f model2f model3f model4f using "2_Tables/C6.doc", replace label b(3) se(3) title(Change in BJP voteshare) mgroups("State elections" "National elections", pattern(1 0 1 0)) mtitles("Pre-delimitation" "Post-delimitation" "Pre-delimitation" "Post-delimitation") scalars("ymean Mean Δ BJP voteshare" "fe Fixed effects" "cl Cluster SE") drop(_cons) rtf varwidth(17) substitute("\fs20" "\fs16" "\fs24" "\fs20")
log close
